package com.huatai.bpmn.controller;


import com.huatai.bpmn.commom.util.NewWechatUtils;
import com.huatai.bpmn.entity.UserEntity;
import com.huatai.bpmn.service.DepartmentService;
import com.huatai.common.api.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 部门用户表 前端控制器
 * </p>
 *
 * @author yxy
 * @since 2023-09-20
 */
@RestController
@RequestMapping("/departmentUser")
@Api(value = "部门用户信息",tags ="部门用户信息" )
public class DepartmentUserController {

	@Autowired
	private DepartmentService departmentService;


	@ApiOperation("部门数据同步")
	@GetMapping("/pullData")
	public R pullData(){
		boolean flag=departmentService.pullData();
		return flag? R.success("成功"):R.fail("失败");
	}

	@ApiOperation("根据部门id获取用户")
	@GetMapping("/getUserByDepartId/{departId}")
	public R getUserByDepartId(@PathVariable String departId){
		List<UserEntity> list=departmentService.getUserByDepartId(departId);
		return R.data(list);
	}
}

